-
Notifications
You must be signed in to change notification settings - Fork 1
Ignore missing URL parts in NavItem activity check #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/django_simple_nav/nav.py
Outdated
| parsed_url.scheme | ||
| and (parsed_url.scheme != parsed_request.scheme) | ||
| or parsed_url.netloc | ||
| and (parsed_url.netloc != parsed_request.netloc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please group these by the order of operations so that it's easier to maintainer.
I think you were going for roughly:
if (
(parsed_url.scheme and parsed_url.scheme != parsed_request.scheme)
or
(parsed_url.netloc and parsed_url.netloc != parsed_request.netloc)
):There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boolean operators have higher precedence than comparison operators, so wouldn't (parsed_url.scheme and parsed_url.scheme != parsed_request.scheme) be the same as ((parsed_url.scheme and parsed_url.scheme) != parsed_request.scheme)? This would compare a boolean to a string, which will always fail. What I wanted to express was (parsed_url.scheme and (parsed_url.scheme != parsed_request.scheme)).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. I think the latter might make the most sense then. I think the grouping would spell it out more and be easier for us to maintain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I have added parentheses around the operators of the or.
|
bump Is there anything that's missing? |
joshuadavidthomas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, looks good. Sorry for the delay in actually reviewing this, thanks for the contribution.
Closes westerveltco#169. If the URL of a navigation item is missing the scheme or the network location we ignore it in the check.
for more information, see https://pre-commit.ci
bc78bb2 to
a8bf324
Compare
Closes #169. If the URL of a navigation item is missing the scheme or the network location we ignore it in the check.